import { defineStore } from 'pinia';
// 定义创建文章数据存储对象的方法
const useArticleStore = defineStore('article', {
    state() {
        return {
            // 文章列表
            articleList: []
        }
    },
    actions: {
        async getArticleList() {
            const res = await fetch('https://cnodejs.org/api/v1/topics').then(response => response.json());
            this.articleList = res.data;
            console.log(this.articleList);
        },
        articleDel(index) {
            this.articleList.splice(index, 1);
        }
    }
});

export default useArticleStore;